Created on: 2025-08-20 14:01:58
Setup
Code
library(GeoPressureR)
library(GeoMag)
library(ggplot2)
library(tidyverse)
id <- params$id
load(here::here(glue::glue("data/interim/{id}.RData")))
path <- read_csv(here::here("data/dist2ref.csv"), show_col_types = FALSE) %>%
filter(tag_id==id & j==0)
Plot acceleration
Code
df_magnetic <- tag$magnetic %>%
filter(is_static < 1) %>%
pivot_longer(acceleration_x:acceleration_z, names_to = "Component", values_to = "Value")
ggplot(df_magnetic, aes(x = Value)) +
geom_histogram(bins = 30, fill = "steelblue", color = "black", alpha = 0.7) +
facet_wrap(~Component, scales = "fixed") + # Fixed scales for uniform axes
xlim(-max(abs(df_magnetic$Value)), max(abs(df_magnetic$Value))) +
theme_minimal()
Code
plot_mag(tag,"acceleration")
Code
tag$magnetic %>%
filter(is_static < 4) %>%
transmute(
pitch = pitch / pi * 180,
roll = roll / pi * 180
) %>%
pivot_longer(cols = c(pitch, roll), names_to = "variable", values_to = "value") %>%
ggplot(aes(x = value)) +
geom_histogram(bins = 30, fill = "gray", color = "black") +
facet_wrap(~variable, scales = "free_x") +
labs(x = "Angle (degrees)", y = "Count") +
theme_minimal()
Plot Magnetic
Code
plot_mag(tag, type="calib")
Plot Map
Code
plot(tag, "map_magnetic_intensity", path = path)
Code
plot(tag, "map_magnetic_inclination", path = path)
Error to known
Code
plot_mag(tag, type="timeseries", path = path)
Code
plot_mag(tag, type="histogram", path = path)